
#import "C_BTN_ReadLog.h"

@implementation C_BTN_ReadLog


-(void) awakeFromNib  {
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(awake:) name:@"Awake" object:nil];
}

-(void)awake:(NSNotification *) notification
{
      [[NSNotificationCenter defaultCenter] postNotificationName:@"Load" object:nil];
   
    NSError * err;
    NSString * text = [[NSString alloc] initWithContentsOfFile:@"/var/log/firewall.log" encoding:NSUTF8StringEncoding error:&err];
  //  NSLog(@"text from log is:%@", text);
    if(text!=NULL){
    [textView selectAll:@""];
    [textView insertText:text];
    }
}

-(IBAction)performClick:(id)sender;
{
	NSError * err;
    NSString * text = [[NSString alloc] initWithContentsOfFile:@"/var/log/firewall.log" encoding:NSUTF8StringEncoding error:&err];
 //   NSLog(@"text from log is:%@", text);
    if(text!=NULL){
        [textView selectAll:@""];
        [textView insertText:text];
    }
    
}

@end
